<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var that;
        function User(name){
            this.name=name;
            that=this;
        }

        var tom=new User("tom");
        //1、创建空对象  var tom={};
        console.log(tom);
        //2、将对象的__proto__属性指向构造器的原型prototype
        console.log(tom.__proto__===Object.prototype);
        //3、调用构造函数，this指向实例对象
        console.log(that===tom);
        var jack={};
        User.call(jack,"jack");  //借调构造函数
        console.log(jack);
        //4、如果函数没有返回，则返回this对象

    </script>
</body>
</html>